#include <iostream>
#include <string>
#include <regex>

int main()
{
    std::string str = "/number/1234";
    // 匹配以 /numbers/起始，后边跟了一个或多个数字字符的字符串，并且在匹配的过程中提取这个匹配到的数字字符串
    std::regex rx("/number/(\\d+)");
    std::smatch match;
    bool ret = std::regex_search(str, match, rx);
    if (ret == false)
    {
        return -1;
    }
    for (auto &s : match)// match[0]原始字符串，match[1]提取的数字字符串
    {
        std::cout << s << std::endl;
    }
    return 0;
}